/*
 * Copyright (c) 2012-2014, EpicSaaS Yuan Xin technology Co., Ltd.
 * 
 * All rights reserved.
 */
package com.epicsaas.app.ksdapp.controller.phone;

import com.epicpaas.sdk.core.api.logging.Logger;
import com.epicpaas.sdk.core.api.logging.LoggerFactory;
import com.epicpaas.sdk.core.api.ServiceResult;
import com.epicsaas.framework.util.DateTimeUtils;
import com.epicsaas.app.ksdapp.common.MVCViewName;
import com.epicsaas.app.ksdapp.android.bean.VersionInfo;
import com.epicsaas.app.ksdapp.appobject.ClientVersionAO;

import java.util.Date;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * ClientVersion控制器。
 * 
 */
@Controller
@RequestMapping(value = "/phone/clientversion")
public class ClientVersionController {

    private static Logger LOG = LoggerFactory.getLogger(ClientVersionController.class);

    @RequestMapping(value = "/login/current", method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public Object current(Model model, HttpServletRequest request) {
        LOG.info("有访问来自，IP: %s USER-AGENT: %s", request.getRemoteAddr(), request.getHeader("user-agent"));
        LOG.info("SessionId %s", request.getSession().getId());

        VersionInfo ret = new VersionInfo();
        ret.setAppUrl("http://app.kongshidian.com/static/app/kongshidian.apk");
        ret.setModifyDate(System.currentTimeMillis());
        ret.setVersionCode(3);
        ret.setVersionInfo("更新购物车");
        ret.setVersionName("空时店 1.0.1");

        return ret;
    }

}
